package com.tuling.code.jdk8;

public class InterfaceTest {
	public static void main(String[] args) {
		SmsMessage sms = new SmsMessageImpl();
		sms.defaultMethod();
		SmsMessage.staticMethod();
		sms.sendMessage("13888888888", "给张飞老师发送了一个小道消息");
	}
}

interface SmsMessage{
	
	//以前就支持
	static final int a = 10;
	
	void sendMessage(String phone , String content);
	
	//jdk1.8支持的接口中声明静态方法
	static void staticMethod(){
		System.out.println("这是接口中的静态方法");
	}
	
	//jdk1.8支持default method
	default void defaultMethod(){
		System.out.println("这是接口中的普通方法");
	}
}

class SmsMessageImpl implements SmsMessage{

	@Override
	public void sendMessage(String phone, String content) {
		System.out.println("phone = "+phone + " , content="+content);
	}
	
}